import { createRouter, createWebHashHistory } from "vue-router";

import Index from "~/pages/index.vue";
import NotFound from "~/pages/404.vue";
import Login from "~/pages/login.vue";
import FoodList from "~/pages/foodList.vue"; // 新增美食列表页面
import RecipeList from "~/pages/recipeList.vue"; // 新增菜谱列表页面
import Release from "~/pages/release.vue"; // 新增关于我们页面
import User from "~/pages/user.vue"; 
import FoodDetail from "~/pages/foodDetail.vue"; 
import RecipeDetail from "~/pages/recipeDetail.vue"; 

const routes = [
    {
        path: "/",
        name: "index",
        component: Index,
        meta:{
            title: "首页"
        }
    },
    {
        path: "/:pathMatch(.*)*",
        name: "NotFound",
        component: NotFound,
        meta:{
            title: "404"
        }
    },
    {
        path: "/login",
        name: "login",
        component: Login,
        meta:{
            title: "登录"
        }

    },
    {
        path: "/foodList",
        name: "foodList",
        component: FoodList,
        meta:{
            title: "美食列表"
        }
    },
    {
        path: "/recipeList",
        name: "recipeList",
        component: RecipeList,
        meta:{
            title: "菜谱列表"
        }
    },
    {
        path:"/release",
        name: "release",
        component: Release,
        meta:{
            title: "发布信息"
        }
    },
    {
        path:"/user",
        name: "user",
        component: User,
        meta:{
            title: "个人中心"
        }
    },{
        path: "/foodDetail/:id",
        name: "foodDetail",
        component: FoodDetail,
        meta:{
            title: "美食详情"
        }
    },{
        path: "/recipeDetail/:id",
        name: "recipeDetail",
        component: RecipeDetail,
        meta:{
            title: "食谱详情"
        }
    }
];

const router = createRouter({
    history: createWebHashHistory(),
    routes
});

export default router;